package org.shangma.exercise;

/**
 * @classname:demo07
 * @description:
 * @author: Mr.Z
 * @date: 2020/11/24 19:07
 * @version: 0.1
 * @since:1.8
 */
public class demo07 {
    public static void main(String[] args) {
//   .定义一个变量，是一个三位数，求各个位数的和. 如：123，结果是1+2+3=6
        int num = 123;
        int a = num / 100;
        int b = num / 10 % 10;
        int c = num % 10;
        System.out.println("结果是:" + (a + b + c));
    }
}
